package com.cangshi.permission.entity;

import java.util.Map;
import java.util.Set;

/**
 * Created by Eoly on 2017/4/5.
 */
public abstract class ObjectSources {

    private Map<Integer, Set<String>> rolesMap;

    private AuthorizationEntity entity;

    private Integer defaultPermissionKey = -1;

    private String keyt = "cangshi";

    private Boolean defaultIntercepted = true;

    private String defaultHeaderName = "Authorization";

    private String defaultContentStart = "";

    private String charset = "UTF-8";

    private Class entityClass;

    protected abstract UserSubject.CheckAndBuild checkAndBuild(Token token);

    protected abstract Boolean checkAuthorizationEntity(AuthorizationEntity entity);

    protected void makeEntity(AuthorizationEntity entity) {
        this.entity = entity;
    }

    public AuthorizationEntity getEntity() {
        return entity;
    }

    public Map<Integer, Set<String>> getRolesMap() {
        return rolesMap;
    }

    public void setRolesMap(Map<Integer, Set<String>> rolesMap) {
        this.rolesMap = rolesMap;
    }

    public String getKeyt() {
        return keyt;
    }

    public void setKeyt(String keyt) {
        this.keyt = keyt;
    }

    public Integer getDefaultPermissionKey() {
        return defaultPermissionKey;
    }

    public void setDefaultPermissionKey(Integer defaultPermissionKey) {
        this.defaultPermissionKey = defaultPermissionKey;
    }

    public Boolean getDefaultIntercepted() {
        return defaultIntercepted;
    }

    public void setDefaultIntercepted(Boolean defaultIntercepted) {
        this.defaultIntercepted = defaultIntercepted;
    }

    public String getDefaultHeaderName() {
        return defaultHeaderName;
    }

    public void setDefaultHeaderName(String defaultHeaderName) {
        this.defaultHeaderName = defaultHeaderName;
    }

    public String getDefaultContentStart() {
        return defaultContentStart;
    }

    public void setDefaultContentStart(String defaultContentStart) {
        this.defaultContentStart = defaultContentStart;
    }

    public Class getEntityClass() {
        return entityClass;
    }

    public void setEntityClass(Class entityClass) {
        this.entityClass = entityClass;
    }

    public String getCharset() {
        return charset;
    }

    public void setCharset(String charset) {
        this.charset = charset;
    }
}
